package com.cxd.app.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.cxd.app.service.LoanService;
import com.cxd.base.controller.BaseController;

/**
 * H5静态页
 * @author wtj
 * @date 2015年12月22日 下午3:26:21
 * @company CXD
 * @version [Copyright (c) 2015 V001]
 */
@Controller("H5Controller")
@RequestMapping("h5c")
public class H5Controller extends BaseController{
	
	@Resource
	LoanService loanService;
	/**
	 * 注册帮助
	 * @author wtj
	 * @date 2015年12月23日下午1:02:55
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_reg", method = {RequestMethod.GET,RequestMethod.POST })
	public void reg_help(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/reg.html");
	}
	
	/**
	 * 关于我们
	 * @author wtj
	 * @date 2015年12月23日下午1:06:30
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_about_us", method = {RequestMethod.GET,RequestMethod.POST })
	public void about_us(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/about_us.html");
	}
	/**
	 * 投资问题
	 * @author wtj
	 * @date 2015年12月23日下午2:23:11
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_invest", method = {RequestMethod.GET,RequestMethod.POST })
	public void help_invest(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/invest.html");
	}
	
	/**
	 * 新手必读
	 * @author wtj
	 * @date 2015年12月23日下午1:06:30
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_new_user", method = {RequestMethod.GET,RequestMethod.POST })
	public void new_user(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/new_user.html");
	}
	
	/**
	 * 安全问题
	 * @author wtj
	 * @date 2015年12月23日下午1:06:30
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_safe", method = {RequestMethod.GET,RequestMethod.POST })
	public void help_safe(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/safe.html");
	}
	
	/**
	 * 充值
	 * @author wtj
	 * @date 2015年12月23日下午1:08:50
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "help_withdraw", method = {RequestMethod.GET,RequestMethod.POST })
	public void withdraw(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/withdraw.html");
	}
	
	/**
	 * 合同
	 * @author wtj
	 * @date 2015年12月23日下午1:08:50
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "contract", method = {RequestMethod.GET,RequestMethod.POST })
	public void contract(HttpServletRequest request,HttpServletResponse response,String userId,String loanId,String investId)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		Map<String,Object> map = loanService.loadLoanContract(loanId);
		root.put("contractType", map.get("CONTRACT_TYPE"));
		root.put("contractInfo",loanService.contract(userId,loanId,investId,map));
		this.writeTemplate(response, root, "/tpl/help_center/contract.html");
	}
	
	/**
	 * 最新公告
	 * @author wtj
	 * @date 2015年12月23日下午1:08:50
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "information", method = {RequestMethod.GET,RequestMethod.POST })
	public void information(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/information.html");
	}
	
	/**
	 * 注册协议
	 * @author wtj
	 * @date 2015年12月31日下午4:27:28
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "service_agree", method = {RequestMethod.GET,RequestMethod.POST })
	public void service_agree(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/service_agree.html");
	}
	
	/**
	 * 提现说明
	 * @author wtj
	 * @date 2015年12月23日下午1:08:50
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "recharge", method = {RequestMethod.GET,RequestMethod.POST })
	public void recharge(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/recharge.html");
	}
	
	/**
	 * 积分规则
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "integral_rules", method = {RequestMethod.GET,RequestMethod.POST })
	public void integral_rules(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/tpl/help_center/integral_rules.html");
	}
	
	/**
	 * 线下见面会申请-pc
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "ol_meeting", method = {RequestMethod.GET,RequestMethod.POST })
	public void offlineMeeting(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/meeting/html/three_meet.html");
	}
	
	/**
	 * 线下见面会申请-app
	 * @param request
	 * @param response
	 * @throws IOException
	 */
	@RequestMapping(value = "offline_meeting", method = {RequestMethod.GET,RequestMethod.POST })
	public void olMeeting(HttpServletRequest request,HttpServletResponse response)throws IOException {
		Map<String, Object> root = new HashMap<String,Object>();
		this.writeTemplate(response, root, "/meeting/wap/three_meet.html");
	}
}
